// var express = require('express'),
    // cookieParser = require('cookie-parser'),
    // router = express.Router(),
    
var home = require('./page/home'),
    kind = require('./page/kind'),
    product = require('./page/product');
    edit = require('./page/edit'),
    diy = require('./page/diy');
    // pay = require('./page/pay'),
    // orderList = require('./page/order-list'),
    // request = require('request'),
    // crypto = require('crypto'),
module.exports = function(app) {
    // console.log(app);
    // console.log(app.request.cookies);// undefined；
    // 设置 Cookie[1:简体中文,2:繁体中文,3:英文]
    // 初始化中文
    // app.use(cookieParser());

    app.use('/', home);
    app.use('/kind', kind);
    app.use('/product', product);
    app.use('/edit', edit);
    app.use('/diy', diy);
    // app.use('/pay', pay);
    // app.use('/order', orderList);


    //反向代理（这里把需要进行反代的路径配置到这里即可）
    //eg:将/api/test 代理到 ${HOST}/api/test
    // http://127.0.0.1:8001/ravimg?src=/uploads/mask/20180322/3f74aa30473bf518d10e289e08d1592c.png
    // app.use('/ravimg', function(req, res) {
    //     const method = req.method.toLowerCase();
    //     const sreq = request[method](kakarotto.config.api.origin + req.query.src);
    //     if (method === 'post' || method === 'put') {
    //         sreq.set('Content-Type', 'application/json').send(req.body)
    //     }
    //     sreq.pipe(res);
    //     sreq.on('end', function(error, res) {
    //         if (error) {
    //             console.log(error);
    //             return;
    //         }
    //     });
    // });
    // app.get('/revMd5', function(req, res) {
    //     console.log(req.query);
    //     var timestamp = parseInt(parseInt(new Date().getTime()) / 1000),
    //         paySign = "appId=" + config.appid + "&nonceStr=" + config.getticket.noncestr + "&package=" + req.query.package + "&signType=MD5&timeStamp=" + timestamp + "&key=" + config.shopKey;
    //     paySign = crypto.createHash('md5').update(paySign, 'utf8').digest('hex');
    //     res.send({
    //         appId: config.appid,
    //         nonceStr: config.getticket.noncestr,
    //         timeStamp: timestamp.toString(),
    //         paySign: paySign,
    //         signType: "MD5",
    //         package: req.query.package
    //     });
    // });
    /**/
};